Repository navigation
fix: allow casting runtime state writes - #1898
Conversation
Closes #1876 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The allowlist change is narrowly scoped to the three required casting keys and is backed by targeted SDK and MCP integration tests that confirm both acceptance and continued rejection of other casting/* paths.
Pull request overview
This PR fixes a contract mismatch in the Squad SDK’s runtime state key validation so that state-mcp can persist the three coordinator-required casting runtime state files (casting/policy.json, casting/registry.json, casting/history.json) on non-local backends, while still rejecting arbitrary casting/* mutations. It aligns the SDK allowlist with Issue #1876 and adds coverage at both the SDK validation layer and the CLI MCP bridge layer.
Changes:
- Allowlist exactly
casting/policy.json,casting/registry.json, andcasting/history.jsonas mutable runtime state tool keys. - Add SDK-level tests to ensure those keys are accepted and other
casting/*paths remain rejected without worktree mutation. - Add
state-mcpintegration tests covering bothorphanandtwo-layerbackends, plus tighten test repo staging to specific files.
File summaries
| File | Description |
|---|---|
packages/squad-sdk/src/tools/index.ts |
Extends mutable runtime state validation to include the three specific casting JSON keys and updates the error message accordingly. |
test/state-backend.test.ts |
Adds regression coverage verifying only the three casting keys can be written via squad_state_write and that worktree .squad is not mutated. |
test/cli/state-mcp.test.ts |
Adds MCP-bridge integration coverage ensuring casting keys can be written/read through both orphan and two-layer backends and keeps the git worktree clean. |
.changeset/casting-runtime-state.md |
Publishes patch changesets for both @bradygaster/squad-cli and @bradygaster/squad-sdk. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| Status | Check | Details |
|---|---|---|
| ✅ | Single commit | 1 commit — clean history |
| ✅ | Not in draft | Ready for review |
| ✅ | Branch up to date | Up to date with dev |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | Changeset file found |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ✅ | Copilot threads resolved | No Copilot review threads |
| ✅ | CI passing | All checks passing |
Files Changed (4 files, +87 −5)
| File | +/− |
|---|---|
.changeset/casting-runtime-state.md |
+6 −0 |
packages/squad-sdk/src/tools/index.ts |
+8 −1 |
test/cli/state-mcp.test.ts |
+49 −4 |
test/state-backend.test.ts |
+24 −0 |
Total: +87 −5
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
🟡 Impact Analysis — PR #1898Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
squad-sdk (1 file)
tests (2 files)
|
Summary
casting/policy.json,casting/registry.json, andcasting/history.jsonthrough runtime state mutationscasting/*paths rejectedstate-mcppersistenceValidation
vitest run test/state-backend.test.ts test/cli/state-mcp.test.tsnpm run lintnpm run buildCloses #1876